package com.gxh.shirotest;

import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;

/**
 * @author Xiaohong X Gou
 * @createTime 2023-04-11 14:39
 * @description
 */
public class ShiroMD5 {
    public static void main(String[] args) {
        //密码明文
        String password="z3";
        //使用MD5加密
        Md5Hash md5Hash = new Md5Hash(password);
        System.out.println("md5加密="+md5Hash.toHex());
        //带盐的加密
        Md5Hash md52 = new Md5Hash(password, "salt");
        System.out.println("带盐的hash="+md52);
        //多次迭代加密
        Md5Hash md53 = new Md5Hash(password, "salt", 3);
        System.out.println("多次迭代加密 = "+md53);
        //使用父类进行加密
        SimpleHash simpleHash = new SimpleHash("MD5", password, "salt", 3);
        System.out.println("使用父类加密 = "+simpleHash);
    }
}
